'''
    九九乘法表8种
'''

print('='*35,'九九乘法表1','='*35)

for i in range(1,10):
    for j in range(1,i+1):
        print('{}*{}={:<4}'.format(i,j,i*j),end=' ')
    print()

print('='*35,'九九乘法表2','='*35)

for i in range(9,0,-1):
    for j in range(i,0,-1):
        print('{}*{}={:<4}'.format(i, j, i * j), end=' ')
    print()

print('='*35,'九九乘法表3','='*35)

for i in range(1,10):
    for j in range(i,0,-1):
        if j == i:
            print(' '*9*(9-i),'{}*{}={:<4}'.format(i,j,i*j),end=' ')
        else:
            print('{}*{}={:<4}'.format(i,j,i*j),end=' ')
    print()

print('='*35,'九九乘法表4','='*35)

for i in range(9,0,-1):
    for j in range(i,0,-1):
        if j == i:
            print(' '*9*(9-i),'{}*{}={:<4}'.format(i,j,i*j),end=' ')
        else:
            print('{}*{}={:<4}'.format(i,j,i*j),end=' ')
    print()

print('='*35,'九九乘法表5','='*35)

i = 1
while i<=9:
    j = 1
    while j<=i:
        print('{}*{}={:<4}'.format(i, j, i * j), end=' ')
        j += 1
    print()
    i += 1

print('='*35,'九九乘法表6','='*35)

i = 9
while i>0:
    j = i
    while j>0:
        print('{}*{}={:<4}'.format(i, j, i * j), end=' ')
        j -= 1
    print()
    i -= 1

print('='*35,'九九乘法表7','='*35)

i = 1
while i<=9:
    j = i
    while j>0:
        if j == i:
            print(' '*9*(9-i),'{}*{}={:<4}'.format(i,j,i*j),end=' ')
        else:
            print('{}*{}={:<4}'.format(i,j,i*j),end=' ')
        j -= 1
    print()
    i += 1



print('='*35,'九九乘法表8','='*35)

i = 9
while i>0:
    j = i
    while j>0:
        if j == i:
            print(' '*9*(9-i),'{}*{}={:<4}'.format(i,j,i*j),end=' ')
        else:
            print('{}*{}={:<4}'.format(i,j,i*j),end=' ')
        j -= 1
    print()
    i -= 1